package com.tang.test;
import com.tang.pojo.CartItems;
import com.tang.pojo.Cart;
public class test2 {
    public static void main(String[] args) {
        CartItems ci=new CartItems();
        ci.setId(1);
        ci.setName("烤肠");
        ci.setCount(2);
        ci.setPrice(3.5);
        CartItems ci2=new CartItems();
        ci2.setId(2);
        ci2.setName("汽水");
        ci2.setCount(1);
        ci2.setPrice(2.5);
        CartItems ci3=new CartItems();
        ci3.setId(3);
        ci3.setName("辣条");
        ci3.setCount(4);
        ci3.setPrice(0.5);
        Cart ct=new Cart();
        ct.addItem(ci);
        ct.addItem(ci2);
        ct.addItem(ci);
        //ct.updateCount(ci2,5);
        ct.clearCart();
        for(CartItems cat:ct.getItems()){
            System.out.println(cat);
        }
        System.out.println("当前购物车的总数量:"+ct.getCountTotal());
        System.out.println("当前购物车的总金额:"+ct.getPriceTotal());
    }
}
